package com.yf.cn.mysb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Thymeleaf入门案例
 *
 *
 */
@Controller
public class DemoController {
	@RequestMapping("/show")
	public String showInfo(Model model){
		model.addAttribute("msg", "Thymeleaf 第一个案例");
		return "index";
	}
	
	
	@RequestMapping("/show1")
	@ResponseBody
	public ModelAndView showInfo(){
		ModelAndView mv = new ModelAndView("index");
        return mv;
	}
	
	
	@RequestMapping("/test1")
	public String test1(){
		String str = null;
		str.length();
        return "index";
	}
	
	/**
	 * ArithmeticException是出现异常的运算条件时，
	 * 抛出此异常。例如，一个整数“除以零”时，抛出此类的一个实例。
	 * @return
	 */
	@RequestMapping("/test2")
	public String test2(){
		int a = 1/0;
        return "index";
	}
}
